<?php require_once('Connections/learnConn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_learnConn, $learnConn);
$query_pengumuman = "SELECT * FROM pengumuman ORDER BY id_pengumuman DESC";
$pengumuman = mysql_query($query_pengumuman, $learnConn) or die(mysql_error());
$row_pengumuman = mysql_fetch_assoc($pengumuman);
$totalRows_pengumuman = mysql_num_rows($pengumuman);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pengumuman</title>
<link href="style/style.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="style/pro_drop_1.css" />
<script src="style/stuHover.js" type="text/javascript"></script>
<link href="style/pro_drop_1.css" type="text/css" rel="stylesheet"/>
<script src="style/stuHover.js" type="text/javascript"></script>
</head>

<body><center>

<table width="900" bgcolor="#FFFFFF">
	<?php
	include "topmenu.php";
	?>
    <tr>
    	<td id="menu">
		<br>
		<br>
		<img src="gambar/smp5.png" />
		<!--
        <ul>
        	<li><a href="index.php">Home</a></li>
            <li><a href="profil.php">Profil</a></li>
        	<li><a href="fasilitas.php">Fasilitas</a></li>
            <li><a href="kegiatan.php">Kegiatan</a></li>
        	<li><a href="pengumuman.php">Pengumuman</a></li>
            <li><a href="buku_tamu.php">Buku Tamu</a></li>
        	<li><a href="nilai_jadwal.php">Nilai & Jadwal</a></li>
            <li><a href="login.php">Login</a></li>
        </ul>
		-->
        </td>
    	<td id="konten"><p><font face='Arial' size='5' color='#0000ff'><b></b></font></p>
   	      <table width="100%" border="1">
   	        <?php do { ?>
            <tr>
              <td> <?php echo $row_pengumuman['tgl_pengumuman']; ?> - <b><?php echo $row_pengumuman['judul_pengumuman']; ?></b> - <i><?php echo substr($row_pengumuman['isi_pengumuman'],0,20); ?>...</i> <a href="pengumuman_detail.php?id_pengumuman=<?php echo $row_pengumuman['id_pengumuman']; ?>">read more</a></td>
            </tr>
   	          <?php } while ($row_pengumuman = mysql_fetch_assoc($pengumuman)); ?>
          </table>
        <p>&nbsp;</p></td>
    </tr>
    <tr>
    	<td colspan="2" id="footer">Copyright 2012</td>
    </tr>
    
</table></center>
</body>
</html>
<?php
mysql_free_result($pengumuman);
?>
